package com.qianfeng.search_7004.controller;

import com.qianfeng.search_7004.entity.User;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * author: 田晋宇
 * datetime:2021/10/25 11:05
 * email:853796359@qq.com
 */
@RestController
public class SearchController {

    @RequestMapping("/search")
    public  String helloSearch(){


        return "search_7004:"+new Date();
    }


    @RequestMapping("/s1/{id}")
    public String s1(@PathVariable("id") Integer id){

        if(id==0){
            int i =1/0;
        }
        return "s1_service:"+Math.random();
    }

    @RequestMapping("/s2")
    public String s2(Integer id,String name){
        return "s2_service:"+id+name;
    }

    @RequestMapping("/s3")
    public User s3(@RequestBody User user){
        System.out.println("s:"+user);
        return user;
    }
}
